#include <iostream>
#include <algorithm>
#include <cstdio>
#include <array>
using namespace std;
#ifdef ONLINE_JUDGE

//#define getchar() (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin), p1 == p2) ? EOF : *p1++)
//char buf[1 << 23], *p1 = buf, *p2 = buf, ubuf[1 << 23], *u = ubuf;

#endif
int read() {
	int p = 0, flg = 1;
	char c = getchar();
	while (c < '0' || c > '9') {
		if (c == '-') flg = -1;
		c = getchar();
	}
	while (c >= '0' && c <= '9') {
		p = p * 10 + c - '0';
		c = getchar();
	}
	return p * flg;
}
void write(int x) {
	if (x < 0) {
		x = -x;
		putchar('-');
	}
	if (x > 9) {
		write(x / 10);
	}
	putchar(x % 10 + '0');
}
bool _stmer;

const int N = 1e6 + 5, inf = 1e9;

array <array <array <int, 3>, 2>, N> f;

char strbuf[N];

bool _edmer;
int main() {
	cerr << (&_stmer - &_edmer) / 1024.0 / 1024.0 << "MB\n";
#ifndef cxqghzj
	freopen("hard.in", "r", stdin);
	freopen("hard.out", "w", stdout);
#endif
	int n = read();
	string s1, s2;
	scanf("%s", strbuf), s1 = strbuf, s1 = " " + s1;
	scanf("%s", strbuf), s2 = strbuf, s2 = " " + s2;
#define upd(x, y) (x = min(x, y))
	for (int j = 0; j < 2; j++) f[0][j].fill(inf);
	f[0][0][0] = 0;
	for (int i = 1; i <= n; i++) {
		for (int j = 0; j < 2; j++) f[i][j].fill(inf);
		if (s1[i] == s2[i])
			for (int j = 0; j < 2; j++)
				for (int k = 0; k < 3; k++)
					upd(f[i][0][0], f[i - 1][j][k]);
		else
			for (int j = 0; j < 2; j++)
				for (int k = 0; k < 3; k++)
					upd(f[i][1][0], f[i - 1][j][k] + !j);
		if (s2[i] == '0') {
			for (int j = 0; j < 2; j++) {
				for (int k = 0; k < 3; k++) {
					upd(f[i][0][1], f[i - 1][j][k] + !(k == 1));
					upd(f[i][1][2], f[i - 1][j][k] + !(k == 2) + !j);
				}
			}
		}
		else {
			for (int j = 0; j < 2; j++) {
				for (int k = 0; k < 3; k++) {
					upd(f[i][0][2], f[i - 1][j][k] + !(k == 2));
					upd(f[i][1][1], f[i - 1][j][k] + !(k == 1) + !j);
				}
			}
		}
	}
	int ans = inf;
	for (int j = 0; j < 2; j++)
		for (int k = 0; k < 3; k++)
			ans = min(ans, f[n][j][k]);
	write(ans), puts("");
	return 0;
}
